package com.allwees.bs.c.module.user.entity;


import com.allwees.bs.c.module.base.entity.JpaBaseEntity;
import com.allwees.bs.c.module.merchant.entity.StoreEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Entity()
@Table(name = "usr_store_collection")
public class StoreCollectionEntity extends JpaBaseEntity implements Serializable {

	@Column(name = "user_uuid", length = 64)
	private String userUuid;

    @Column(name = "store_uuid", length = 64, insertable = false, updatable = false)
    private String storeUuid;


    @OneToOne(fetch=FetchType.EAGER)
    @JoinColumn(name = "store_uuid", referencedColumnName = "uuid")
    private StoreEntity store;

    public StoreCollectionEntity(String userUuid, StoreEntity store) {
        super();
        this.userUuid = userUuid;
        this.store = store;
    }
}
